<template>
  <div>
    <el-row :gutter="20" type="flex">
      <el-col :span="6">
        <el-input
          placeholder="请输入专业名称"
          v-model="listQueryIn.name"
          clearable
        >
        </el-input>
      </el-col>
      <el-col :span="6">
        <TrainingSelect @e-trainData="setTrainId" />
      </el-col>
      <el-col :span="6">
        <el-button type="custom" @click="refreshList()" plain>搜索</el-button>
        <el-button type="custom" @click="handleAdd()" v-if="$button('792')"
          >新增专业</el-button
        >
      </el-col>
    </el-row>
  </div>
</template>
<script>
import Bus from '@/utils/bus.js'
export default {
  components: {
    TrainingSelect: () => import('@/components/trainingSelect'),
  },
  data() {
    return {
      listQueryIn: {
        name: '',
        levelId: '',
      },
    }
  },
  methods: {
    refreshList() {
      Bus.$emit('refreshMajorList', this.listQueryIn)
    },
    handleAdd() {
      Bus.$emit('showDialogMajorAdd')
    },
    setTrainId(v) {
      this.listQueryIn.levelId = v || ''
    },
  },
}
</script>